<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>3D场景管理系统</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: 'Arial', sans-serif;
            background: #1a1a1a;
            color: white;
            overflow: hidden;
        }
        
        #app {
            width: 100vw;
            height: 100vh;
            position: relative;
        }
        
        #scene-container {
            width: 100%;
            height: 100%;
            position: absolute;
            top: 0;
            left: 0;
        }
        
        .ui-panel {
            position: absolute;
            top: 20px;
            left: 20px;
            z-index: 1000;
            background: rgba(0, 0, 0, 0.7);
            border-radius: 10px;
            padding: 20px;
            backdrop-filter: blur(10px);
        }
        
        .scene-buttons {
            display: flex;
            gap: 10px;
            margin-bottom: 20px;
        }
        
        .scene-btn {
            padding: 12px 20px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border: none;
            border-radius: 6px;
            color: white;
            cursor: pointer;
            transition: all 0.3s ease;
            font-weight: bold;
        }
        
        .scene-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
        }
        
        .scene-btn.active {
            background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
            box-shadow: 0 5px 15px rgba(240, 147, 251, 0.4);
        }
        
        .loading-overlay {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.8);
            display: flex;
            justify-content: center;
            align-items: center;
            z-index: 2000;
            opacity: 1;
            transition: opacity 0.5s ease;
        }
        
        .loading-overlay.hidden {
            opacity: 0;
            pointer-events: none;
        }
        
        .loader {
            width: 60px;
            height: 60px;
            border: 3px solid rgba(255, 255, 255, 0.1);
            border-top: 3px solid #667eea;
            border-radius: 50%;
            animation: spin 1s linear infinite;
        }
        
        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }
        
        .performance-info {
            margin-top: 10px;
            font-size: 12px;
            color: #aaa;
        }
        
        /* 详细加载界面样式 */
        .loading-screen {
            position: fixed;
            top: 0;
            left: 0;
            width: 100vw;
            height: 100vh;
            background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 10000;
            opacity: 1;
            transition: opacity 0.5s ease-out;
        }
        
        .loading-screen.hidden {
            opacity: 0;
            pointer-events: none;
        }
        
        .loading-content {
            background: rgba(255, 255, 255, 0.1);
            backdrop-filter: blur(20px);
            border-radius: 20px;
            padding: 40px;
            max-width: 600px;
            width: 90%;
            text-align: center;
            border: 1px solid rgba(255, 255, 255, 0.2);
        }
        
        .loading-header h2 {
            font-size: 2.5em;
            margin-bottom: 10px;
            background: linear-gradient(45deg, #667eea, #764ba2);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }
        
        .loading-subtitle {
            font-size: 1.1em;
            color: rgba(255, 255, 255, 0.8);
            margin-bottom: 30px;
        }
        
        .loading-progress-container {
            margin: 30px 0;
        }
        
        .progress-section {
            margin-bottom: 20px;
        }
        
        .progress-label {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 8px;
            font-size: 14px;
        }
        
        .progress-label span:first-child {
            font-weight: bold;
        }
        
        .progress-percentage {
            color: #667eea;
            font-weight: bold;
        }
        
        .progress-bar {
            width: 100%;
            height: 8px;
            background: rgba(255, 255, 255, 0.2);
            border-radius: 4px;
            overflow: hidden;
            margin-bottom: 5px;
        }
        
        .progress-fill {
            height: 100%;
            background: linear-gradient(90deg, #667eea, #764ba2);
            border-radius: 4px;
            width: 0%;
            transition: width 0.3s ease;
        }
        
        .progress-info {
            font-size: 12px;
            color: rgba(255, 255, 255, 0.7);
            text-align: left;
        }
        
        .loading-stats {
            display: grid;
            grid-template-columns: repeat(5, 1fr);
            gap: 15px;
            margin: 25px 0;
            padding: 20px;
            background: rgba(255, 255, 255, 0.05);
            border-radius: 10px;
        }
        
        .stat-item {
            text-align: center;
        }
        
        .stat-value {
            font-size: 1.5em;
            font-weight: bold;
            color: #667eea;
            margin-bottom: 5px;
        }
        
        .stat-label {
            font-size: 12px;
            color: rgba(255, 255, 255, 0.7);
        }
        
        .model-list {
            margin-top: 20px;
            text-align: left;
        }
        
        .model-list-header {
            font-weight: bold;
            margin-bottom: 15px;
            padding-bottom: 8px;
            border-bottom: 1px solid rgba(255, 255, 255, 0.2);
        }
        
        .model-items {
            max-height: 150px;
            overflow-y: auto;
            padding-right: 10px;
        }
        
        .model-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 8px 12px;
            margin-bottom: 5px;
            background: rgba(255, 255, 255, 0.05);
            border-radius: 6px;
            font-size: 13px;
        }
        
        .model-item.loading {
            background: rgba(102, 126, 234, 0.2);
        }
        
        .model-item.completed {
            background: rgba(46, 204, 113, 0.2);
        }
        
        .model-item.error {
            background: rgba(231, 76, 60, 0.2);
        }
        
        .model-name {
            flex: 1;
            margin-right: 10px;
        }
        
        .model-status {
            font-size: 11px;
            padding: 2px 6px;
            border-radius: 3px;
            background: rgba(255, 255, 255, 0.2);
        }
        
        .model-status.cache {
            background: rgba(52, 152, 219, 0.3);
            color: #3498db;
        }
        
        .model-status.network {
            background: rgba(230, 126, 34, 0.3);
            color: #e67e22;
        }
        
        .model-status.completed {
            background: rgba(46, 204, 113, 0.3);
            color: #2ecc71;
        }
        
        .model-status.error {
            background: rgba(231, 76, 60, 0.3);
            color: #e74c3c;
        }
        
        .loading-errors {
            margin-top: 20px;
            padding: 15px;
            background: rgba(231, 76, 60, 0.1);
            border-radius: 8px;
            border-left: 4px solid #e74c3c;
            text-align: left;
        }
        
        .error-header {
            font-weight: bold;
            margin-bottom: 10px;
            color: #e74c3c;
        }
        
        .error-list {
            font-size: 12px;
            color: rgba(255, 255, 255, 0.8);
        }
        
        .error-item {
            margin-bottom: 5px;
            padding: 5px 0;
            border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        }
        
        /* 自定义滚动条 */
        .model-items::-webkit-scrollbar {
            width: 6px;
        }
        
        .model-items::-webkit-scrollbar-track {
            background: rgba(255, 255, 255, 0.1);
            border-radius: 3px;
        }
        
        .model-items::-webkit-scrollbar-thumb {
            background: rgba(255, 255, 255, 0.3);
            border-radius: 3px;
        }
        
        .model-items::-webkit-scrollbar-thumb:hover {
            background: rgba(255, 255, 255, 0.5);
        }
        
        /* 确认按钮样式 */
        .loading-confirmation {
            margin-top: 30px;
            opacity: 0;
            transform: translateY(20px);
            transition: all 0.5s ease;
        }
        
        .loading-confirmation.visible {
            opacity: 1;
            transform: translateY(0);
        }
        
        .confirmation-message {
            font-size: 1.1em;
            color: rgba(255, 255, 255, 0.9);
            margin-bottom: 20px;
            text-align: center;
        }
        
        .confirmation-button {
            background: linear-gradient(45deg, #667eea, #764ba2);
            border: none;
            color: white;
            padding: 15px 40px;
            font-size: 1.1em;
            font-weight: bold;
            border-radius: 50px;
            cursor: pointer;
            transition: all 0.3s ease;
            box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
            position: relative;
            overflow: hidden;
        }
        
        .confirmation-button:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
        }
        
        .confirmation-button:active {
            transform: translateY(0);
        }
        
        .confirmation-button::before {
            content: '';
            position: absolute;
            top: 0;
            left: -100%;
            width: 100%;
            height: 100%;
            background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
            transition: left 0.5s;
        }
        
        .confirmation-button:hover::before {
            left: 100%;
        }
        
        .confirmation-button:disabled {
            opacity: 0.6;
            cursor: not-allowed;
            transform: none;
        }
        
        .confirmation-button:disabled:hover {
            transform: none;
            box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
        }
        
        /* 开关控制样式 */
        .settings-toggle {
            position: absolute;
            top: 20px;
            right: 20px;
            background: rgba(255, 255, 255, 0.1);
            backdrop-filter: blur(10px);
            border-radius: 10px;
            padding: 15px;
            border: 1px solid rgba(255, 255, 255, 0.2);
            z-index: 10001;
        }
        
        .toggle-item {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 10px;
            font-size: 14px;
            color: rgba(255, 255, 255, 0.9);
        }
        
        .toggle-item:last-child {
            margin-bottom: 0;
        }
        
        .toggle-label {
            margin-right: 15px;
        }
        
        .toggle-switch {
            position: relative;
            width: 50px;
            height: 24px;
            background: rgba(255, 255, 255, 0.2);
            border-radius: 12px;
            cursor: pointer;
            transition: background 0.3s ease;
        }
        
        .toggle-switch.active {
            background: #667eea;
        }
        
        .toggle-slider {
            position: absolute;
            top: 2px;
            left: 2px;
            width: 20px;
            height: 20px;
            background: white;
            border-radius: 50%;
            transition: transform 0.3s ease;
            box-shadow: 0 2px 4px rgba(0,0,0,0.2);
        }
        
        .toggle-switch.active .toggle-slider {
            transform: translateX(26px);
        }
    </style>
</head>
<body>
    <div id="app">
        <div id="scene-container"></div>
        
        <div class="ui-panel">
            <div class="scene-buttons">
                <button class="scene-btn active" data-scene="0">几何场景</button>
                <button class="scene-btn" data-scene="1">粒子场景</button>
                <button class="scene-btn" data-scene="2">模型场景</button>
                <button class="scene-btn" data-scene="3">汽车场景</button>
            </div>
            <div class="performance-info">
                <div>FPS: <span id="fps">0</span></div>
                <div>渲染对象: <span id="render-objects">0</span></div>
                <div>内存使用: <span id="memory">0</span>MB</div>
            </div>
            <div style="margin-top: 15px; font-size: 11px; color: #999; line-height: 1.4;">
                <div><strong>控制说明：</strong></div>
                <div>• 鼠标左键：旋转视角</div>
                <div>• 鼠标右键：平移视角</div>
                <div>• 滚轮：缩放视角</div>
            </div>
        </div>
        
        <!-- 设置开关 -->
        <div class="settings-toggle" id="settings-toggle">
            <div class="toggle-item">
                <span class="toggle-label">加载确认</span>
                <div class="toggle-switch active" id="confirmation-toggle">
                    <div class="toggle-slider"></div>
                </div>
            </div>
        </div>
        
        <div class="loading-screen" id="loading-screen">
            <div class="loading-content">
                <div class="loading-header">
                    <h2>Kokomi 3D 场景</h2>
                    <div class="loading-subtitle" id="loading-subtitle">正在预加载所有场景资源...</div>
                </div>
                
                <div class="loading-progress-container">
                    <!-- 总体进度 -->
                    <div class="progress-section">
                        <div class="progress-label">
                            <span>总体进度</span>
                            <span class="progress-percentage" id="overall-percentage">0%</span>
                        </div>
                        <div class="progress-bar">
                            <div class="progress-fill" id="overall-progress"></div>
                        </div>
                        <div class="progress-info">
                            <span id="overall-info">准备中...</span>
                        </div>
                    </div>
                    
                    <!-- 当前模型进度 -->
                    <div class="progress-section">
                        <div class="progress-label">
                            <span id="current-model-name">等待开始...</span>
                            <span class="progress-percentage" id="model-percentage">0%</span>
                        </div>
                        <div class="progress-bar">
                            <div class="progress-fill" id="model-progress"></div>
                        </div>
                        <div class="progress-info">
                            <span id="model-info">-</span>
                        </div>
                    </div>
                    
                    <!-- 统计信息 -->
                    <div class="loading-stats">
                        <div class="stat-item">
                            <div class="stat-value" id="loaded-count">0</div>
                            <div class="stat-label">已加载</div>
                        </div>
                        <div class="stat-item">
                            <div class="stat-value" id="total-count">0</div>
                            <div class="stat-label">总计</div>
                        </div>
                        <div class="stat-item">
                            <div class="stat-value" id="cache-count">0</div>
                            <div class="stat-label">缓存</div>
                        </div>
                        <div class="stat-item">
                            <div class="stat-value" id="network-count">0</div>
                            <div class="stat-label">网络</div>
                        </div>
                        <div class="stat-item">
                            <div class="stat-value" id="data-size">0MB</div>
                            <div class="stat-label">数据量</div>
                        </div>
                    </div>
                    
                    <!-- 模型列表 -->
                    <div class="model-list">
                        <div class="model-list-header">模型加载状态</div>
                        <div class="model-items" id="model-items">
                            <!-- 动态添加模型项 -->
                        </div>
                    </div>
                </div>
                
                <div class="loading-spinner"></div>
                
                <!-- 确认按钮 -->
                <div class="loading-confirmation" id="loading-confirmation">
                    <div class="confirmation-message" id="confirmation-message">
                        ✅ 所有资源加载完成！准备进入3D世界
                    </div>
                    <button class="confirmation-button" id="confirmation-button">
                        进入场景
                    </button>
                </div>
                
                <!-- 错误信息 -->
                <div class="loading-errors" id="loading-errors" style="display: none;">
                    <div class="error-header">⚠️ 加载警告</div>
                    <div class="error-list" id="error-list"></div>
                </div>
            </div>
        </div>
    </div>
    
    <script type="module" src="/src/main.js"></script>
</body>
</html>
